package com.example.asus.worldcup;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class DetailActivity extends AppCompatActivity {
    TextView mTvId;
    ImageView mIvPic;
    TextView mTvMath;
    TextView mTvGoal;
    TextView mTvScore;
    TextView mTvDetail;
    private Team team;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);
       team = (Team)(getIntent().getSerializableExtra("team"));
      //Toast.makeText(this,team.getName(),Toast.LENGTH_SHORT).show();
        initView();
    }

    private void initView() {
        mTvId=findViewById(R.id.tv_id);
        mTvMath=findViewById(R.id.tv_match);
        mTvGoal=findViewById(R.id.tv_goal);
        mTvScore=findViewById(R.id.tv_score);
        mTvDetail=findViewById(R.id.tv_detail);
        mIvPic=findViewById(R.id.iv_pic);

        mTvId.setText(team.getId());
        mIvPic.setImageResource(getResources().getIdentifier(team.getPic(), "mipmap", getPackageName()));
        mTvMath.setText("比赛情况："+"胜"+team.getSheng()+"负"+team.getFu()+"平"+team.getPing());
        //ToDO完善
        mTvGoal.setText("进球情况："+"进球"+team.getWingoal()+"失球"+team.getLosegoal()+"净胜球"+team.getTotalgoal());
        mTvScore.setText("积分："+team.getScore());
        mTvDetail.setText(team.getDetail());
    }
}
